import request from '../../util/request';
import { getMenuApi } from "../../api/runinfo.js";

const sidebar = {
  state: {
    menus:[]
  },
  mutations: {
    updateMenu:(state,menus)=>{
      state.menus = menus;
    }
  },
  actions: {
    loadMenu:(context)=> { 
      getMenuApi().then(function(resp) {
        if (resp.errmsg === "ok") {
          console.log(resp);
          context.commit('updateMenu',resp.data);
        }
      }).catch(function(e) {          
        console.log(e);
      });
    }
  }
}

export default sidebar
